import Vue from 'vue';
import Router from 'vue-router';
//import Abstract from "@/views/common/abstract";
Vue.use(Router);

let baseRoute = [{
  path: '/login',
  name: '登录',
  component: (resolve) => require(['../views/login.vue'], resolve)
}, {
  path: '/401',
  name: '无权访问',
  component: (resolve) => require(['../views/common/401.vue'], resolve)
}, {
  path: '/404',
  name: '找不到页面',
  component: (resolve) => require(['../views/common/404.vue'], resolve)
},{
  path: '/home',
  name: '首页',
  component: (resolve) => require(['../views/index.vue'], resolve),
  children: [{
    path: '/roles',
    name: '平台-角色管理',
    meta: {
      name: '角色管理'
    },
    component: (resolve) => require(['../views/roles.vue'], resolve)
  }, {
    path: '/accounts',
    name: '平台-账号管理',
    meta: {
      name: '账号管理'
    },
    component: (resolve) => require(['../views/accounts.vue'], resolve)
  }, {
    path: '/permission',
    name: '平台-权限管理',
    meta: {
      name: '权限管理'
    },
    component: (resolve) => require(['../views/permission.vue'], resolve)
  }, {
    path: '/activiti',
    name: '平台-流程设计',
    meta: {
      name: '流程设计'
    },
    component: (resolve) => require(['../views/bpmn-editor.vue'], resolve)
  }]
}];

let router = new Router({
  routes: baseRoute
});

// router.beforeEach((to, from, next) => {
//   let routeName = to.meta.name || to.name;
//   window.document.title = (routeName ? routeName + ' - ' : '') + 'Vue-Access-Control';
//   next();
// });

export default router;
